From: Keir Fraser Date: Tue, 20 Apr 2010 13:32:53 +0000 (+0100) Subject: tasklet: Add lock-free exit path from do_tasklet() when no work to do. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12334 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=3cd0ba42d51b8bb2b8e534b52c7d8f10e1676868;p=xen.git tasklet: Add lock-free exit path from do_tasklet() when no work to do. Signed-off-by: Keir Fraser --- diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c index 05665ebc5d..e2109770ad 100644 --- a/xen/common/tasklet.c +++ b/xen/common/tasklet.c @@ -60,9 +60,12 @@ void do_tasklet(void) struct list_head *list = &per_cpu(tasklet_list, cpu); struct tasklet *t; + if ( likely(list_empty(list)) ) + return; + spin_lock_irq(&tasklet_lock); - if ( list_empty(list) ) + if ( unlikely(list_empty(list)) ) { spin_unlock_irq(&tasklet_lock); return;